{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="role" lay-search="">
                                <option  value="">不限角色</option>
                                <option  value="1">用户</option>
                                <option  value="2">商户</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="内容"/>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <ul class="img_view">
                            {{# if(d.f_images.length > 0){ }}
                                <li><img src="{{d.f_images[0]}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"/></li>
                                {{# if(d.f_images.length >= 1){ }}
                                    {{# for(var i=1;i<d.f_images.length;i++){  }}
                                        <li style="display:none;"><img src="{{d.f_images[i]}}" ></li>
                                    {{# } }}
                                {{# } }}
                            {{# } }}
                        </ul>
                    </script>
                    <!--角色模板-->
                    <script type="text/html" id="titleTpl">
                        {{# if(d.f_type == 1){ }}
                            用户
                        {{# }else{ }}
                            商户
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.f_status==1){ }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.f_id}}','{:url('changeStatus')}','确认已处理？')"  class="btn btn-danger btn-xs m-r-xs" >未处理</a>
                        {{# }else{ }}
                        <a href="javascript:;" class="btn btn-primary btn-xs m-r-xs" >已处理</a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("suggest/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: 10
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                , {field: 'area', width: '', title: '地区', align: 'center'}
                , {field: 'f_type', width: '', title: '角色', align: 'center', templet: '#titleTpl'}
                , {field: 'f_images', width: 90, title: '图片', align: 'center', templet: '#imgTpl'}
                , {field: 'f_content', width: '', title: '内容', align: 'center'}
                , {field: 'f_phone', width: '', title: '手机号', align: 'center'}
                , {field: 'name', width: '', title: '反馈人', align: 'center'}
                , {field: 'f_add_time', width: '', title: '反馈时间', align: 'center'}
                , {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]],
            done: function (res, curr, count) {
                $('.img_view').viewer();
            }
        });

        //批量操作
        var $ = layui.$, active = {
            getCheckData: function(){
                //批量删除
                wk.batchDel(getIds(),"{:url('batchDelUser')}");
            }
            ,forbiddenAll: function(){
                //批量禁用
                wk.batchForbidden(getIds(),2,"{:url('forbiddenAdmin')}");
            }
            ,usingAll: function(){
                //批量启用
                wk.usingAll(getIds(),1,"{:url('usingAdmin')}");
            }
            ,excelAll: function(){
                //导出Excel
                wk.excelAll(getIds(),$('#layuiForm').serialize(),"{:url('excelAdmin')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>